Week 3 Computer Science Notes: Structs & Sorting Benchmarks
Section 1: Memory Encapsulation & Struct Architecture
During initial iterations of phone book construction, developers are forced to instantiate decoupled parallel buffers. However, there exists zero physical memory correlation between the two. Bare-metal C provides an explicit mechanism to declare custom composite data types that encapsulate multiple variables inside a unified memory block via typedef struct.
===================================================================================
CUSTOM STRUCT MEMORY ENCAPSULATION
===================================================================================
[ person: people[0] ]
βββ name ββ> Pointer to "David"
βββ number ββ> Pointer to "+1-949-468-2750"
===================================================================================
- Custom Structural Instantiation: Maintains the relational integrity of the database during complex index swapping routines.
Section 2: Mathematical Sorting Benchmarks
The Comprehensive Asymptotic Benchmark Matrix contrasts the distinct asymptotic limits across sorting and searching heuristics.
===================================================================================
ASYMPTOTIC BENCHMARK MATRIX
===================================================================================
Algorithm Worst Case (Big O) Best Case (Big Omega) Paradigm
-----------------------------------------------------------------------------------
Bubble Sort O(n^2) Omega(n) Pairwise Swapping
Selection Sort O(n^2) Omega(n^2) Min Insertion
Merge Sort O(n log n) Omega(n log n) Divide & Conquer
Linear Search O(n) Omega(1) Sequential Search
Binary Search O(log n) Omega(1) Halving Partitions
===================================================================================
- Architectural Understanding of Omega(1): Represents the optimal asymptotic boundary: discovering the target payload on the absolute initial inspection.
Section 3: Recursive Stack Mechanics & Activation Records
When a routine self-invokes, the operating system kernel allocates a distinct activation record within the execution call stack.
- The Base Case Hazard: Omitting a definitive base case condition accumulates frames indefinitely, triggering a fatal Stack Overflow.